<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<script type="text/javascript">
  /*  无参无返回值的方法*/
 function fn1(){
	//获取文本框和div对象
	var i = document.getElementById("i1");
	var d = document.getElementById("d1");
	d.innerText = i.value;
 }
</script>
</head>
<body>
<input type="text" id="i1";>
<input type="button" value="按钮"   onclick="fn1()">
<div id="d1"></div>
</body>
</html>